/*
 * @Author: 吴世扬 18368095041@163.com
 * @Date: 2022-10-12 15:57:32
 * @LastEditors: 吴世扬 18368095041@163.com
 * @LastEditTime: 2022-10-12 16:15:44
 * @FilePath: /vue3-datav/src/views/template/IndexView/left2.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import {
    ringPie,
    ringPie2
} from '@/components/ui/CustomChart/chartOptions/pie';
import { getLeft2Data as request } from '@/api/template';
import { reactive } from 'vue';
export const left2Model = reactive<{
    datasetSource: { name: string; value: number }[],
    option: Record<string, unknown>
}>({
    datasetSource: [],
    option: ringPie
});

export const right1Model = reactive<{
    datasetSource: { name: string; value: number }[],
    option: Record<string, unknown>
}>({
    datasetSource: [],
    option: ringPie2
});

export const getLeft2Data = () => {
    return request().then((res) => {
        left2Model.datasetSource = res.data.map((item) => ({
            name: item.label,
            value: item.num
        }));
        right1Model.datasetSource = res.data.map((item) => ({
            name: item.label,
            value: item.num
        }));
        return res;
    });
}
